//
//  YDEmoticonButton.swift
//  weibo
//
//  Created by 孙亚东 on 16/7/3.
//  Copyright © 2016年 Sunyadong. All rights reserved.
//

import UIKit

class YDEmoticonButton: UIButton {

    var emoticonModel: YDEmoticonModels? {
    
        didSet {
        
            
            //判断
            
            if let png = emoticonModel?.png, path = emoticonModel?.path {
        
                
                let imageName = "\(path)/\(png)"
                self.setImage(UIImage(named: imageName), forState: .Normal)
            
            }else {
            
                self.setImage(nil, forState: .Normal)
            
            
            }
            
            if let emoji = emoticonModel?.emoji{
            
         
                self.setTitle(emoji, forState: .Normal)
            
            
            }else {
            
            
                self.setTitle(nil, forState: .Normal)
            
            }
            
            
            
        
        
        }
    
    
    
    
    }
    

}
